package com.cincc.cinccimdemo.widget;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.cincc.cinccimdemo.R;

public class SequenceUserView extends FrameLayout {
    private Activity mContext;

    public SequenceUserView(Context context) {
        super(context);
        init(context);
    }

    public SequenceUserView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public SequenceUserView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    TextView indexTextView;
    TextView nameTextView;

    @SuppressLint("ClickableViewAccessibility")
    private void init(Context context) {
        this.mContext = (Activity) context;
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(R.layout.sequence_user_item, this);
        indexTextView = findViewById(R.id.index_text);
        nameTextView = findViewById(R.id.nickname_text);
    }

    public void setData(int index, String name) {
        indexTextView.setText(String.valueOf(index));
        nameTextView.setText(name);
    }
}
